#!/usr/bin/env php
<?php

const APP_PATH = __DIR__ . '/';
ini_set('swoole.use_shortname', 'On');
date_default_timezone_set('Asia/Shanghai');


const CORES_HEADERS = ['Access-Control-Allow-Headers' => '*', 'Access-Control-Request-Method' => '*', 'Access-Control-Allow-Origin' => '*'];

ini_set('memory_limit', '4G');
require_once APP_PATH . 'vendor/autoload.php';

use Commands\Kernel;
use Gii\GiiProviders;
use Database\DatabasesProviders;
use Kiri\Server\ServerProviders;

(function ($argv) {
    try {
        application(new Kernel())
            ->import(DatabasesProviders::class, ServerProviders::class, GiiProviders::class)
            ->execute($argv);
    } catch (Throwable $exception) {
        file_put_contents('php://stderr', throwable($exception));
    }
})($argv);
